import Vue from 'vue'
import Router from 'vue-router'
import login from '@/components/login'
import layout from '@/components/layout'

Vue.use(Router)

export default new Router({
  routes: [
    // {
    //   path: '',
    //   name: 'layout',
    //   component: layout
    // },
    {
      path: '/',
      name: 'login',
      component: login
    },
    {
      path: '/404',
      name: 'error404',
      component: () => import('@/components/error/404')
    },
    {
      path: '/news',
      component: layout,
      children: [
        {
          path: 'index',
          name: 'news',
          component: () => import('@/components/news')
        }
      ]
      // redirect: '/layout/news'
    },
    {
      path: '/community',
      name: 'community',
      component: layout,
      children: [
        {
          path: 'topic',
          name: 'topic',
          component: () => import('@/components/community/topic')
        },
        {
          path: 'topicClassify',
          name: 'topicClassify',
          component: () => import('@/components/community/topicClassify')
        },
        {
          path: 'post',
          name: 'post',
          component: () => import('@/components/community/post')
        },
        {
          path: 'activity',
          name: 'activity',
          component: () => import('@/components/community/activity')
        },
        {
          path: 'fixedActivity',
          name: 'fixedActivity',
          component: () => import('@/components/community/fixedActivity')
        },
        {
          path: 'userRank',
          name: 'userRank',
          component: () => import('@/components/community/userRank')
        },
        {
          path: 'repo',
          name: 'repo',
          component: () => import('@/components/community/repo')
        }
      ],
      redirect: '/community/topic'
    },
    {
      path: '/merchant',
      name: 'merchant',
      component: layout,
      children: [
        {
          path: 'list',
          name: 'list-m',
          component: () => import('@/components/merchant/merchant')
        },
        {
          path: 'skirt',
          name: 'skirt',
          component: () => import('@/components/merchant/skirt')
        },
        {
          path: 'shop',
          name: 'shop',
          component: () => import('@/components/merchant/shop')
        },
        {
          path: 'idle',
          name: 'idle',
          component: () => import('@/components/merchant/idle')
        },
        {
          path: 'buying',
          name: 'buying',
          component: () => import('@/components/merchant/buying')
        }
      ],
      redirect: '/merchant/list'
    },
    {
      path: '/user',
      name: 'user',
      component: layout,
      children: [
        {
          path: 'level',
          name: 'level',
          component: () => import('@/components/user/level')
        },
        {
          path: 'group',
          name: 'group',
          component: () => import('@/components/user/group')
        },
        {
          path: 'system',
          name: 'system-u',
          component: () => import('@/components/user/system')
        },
        {
          path: 'common',
          name: 'common',
          component: () => import('@/components/user/common')
        }
      ],
      redirect: '/user/level'
    },
    {
      path: '/message',
      name: 'message',
      component: layout,
      children: [
        {
          path: 'comment',
          name: 'comment',
          component: () => import('@/components/message/comment')
        },
        {
          path: 'black',
          name: 'black',
          component: () => import('@/components/message/black')
        },
        {
          path: 'feedback',
          name: 'feedback',
          component: () => import('@/components/message/feedback')
        },
        {
          path: 'report',
          name: 'report',
          component: () => import('@/components/message/report')
        },
        {
          path: 'sensitive',
          name: 'sensitive',
          component: () => import('@/components/message/sensitive')
        },
        {
          path: 'send',
          name: 'send',
          component: () => import('@/components/message/send')
        }
      ],
      redirect: '/message/comment'
    },
    {
      path: '/system',
      name: 'system',
      component: layout,
      children: [
        {
          path: 'start',
          name: 'start',
          component: () => import('@/components/system/start')
        },
        {
          path: 'about',
          name: 'about',
          component: () => import('@/components/system/about')
        },
        {
          path: 'ad',
          name: 'ad',
          component: () => import('@/components/system/ad')
        },
        {
          path: 'run',
          name: 'run',
          component: () => import('@/components/system/run')
        },
        {
          path: 'banner',
          name: 'banner',
          component: () => import('@/components/system/banner')
        },
        {
          path: 'feedback',
          name: 'feedback-s',
          component: () => import('@/components/system/feedback')
        },
        {
          path: 'remind',
          name: 'remind',
          component: () => import('@/components/system/remind')
        },
        {
          path: 'protocol',
          name: 'protocol',
          component: () => import('@/components/system/protocol')
        },
        {
          path: 'pro',
          name: 'pro',
          component: () => import('@/components/system/pro')
        },
        {
          path: 'levelDes',
          name: 'levelDes',
          component: () => import('@/components/system/levelDes')
        },
        {
          path: 'norm',
          name: 'norm',
          component: () => import('@/components/system/norm')
        },
        {
          path: 'role',
          name: 'role',
          component: () => import('@/components/system/role')
        },
        {
          path: 'formula',
          name: 'formula',
          component: () => import('@/components/system/formula')
        }
      ],
      redirect: '/system/index'
    },
    {
      path: '/count',
      name: 'count',
      component: layout,
      children: [
        {
          path: 'user',
          name: 'info',
          component: () => import('@/components/count/infoCount')
        },
        {
          path: 'clock',
          name: 'clock-count',
          component: () => import('@/components/count/clockCount')
        },
        {
          path: 'news',
          name: 'news-count',
          component: () => import('@/components/count/newsCount')
        },
        {
          path: 'topic',
          name: 'topic-count',
          component: () => import('@/components/count/topicCount')
        }
      ]
    },
    {
      path: '/plate',
      name: 'plate',
      component: layout,
      children: [
        {
          path: 'hotSearch',
          name: 'hotSearch',
          component: () => import('@/components/plate/hotSearch')
        },
        {
          path: 'tag',
          name: 'tag',
          component: () => import('@/components/plate/tag')
        },
        {
          path: 'clock',
          name: 'clock',
          component: () => import('@/components/plate/clock')
        },
        {
          path: 'remind',
          name: 'remind2',
          component: () => import('@/components/plate/remind')
        }
      ],
      redirect: '/plate/search'
    },
    {
      path: '/lottery',
      name: 'lottery',
      component: layout,
      children: [
        {
          path: 'fragmentationList',
          name: 'fragmentationList',
          component: () => import('@/components/lottery/fragmentationList')
        },
        {
          path: 'awardList',
          name: 'awardList',
          component: () => import('@/components/lottery/awardList')
        },
        {
          path: 'redemptionList',
          name: 'redemptionList',
          component: () => import('@/components/lottery/redemptionList')
        },
        {
          path: 'lotterySetting',
          name: 'lotterySetting',
          component: () => import('@/components/lottery/lotterySetting')
        }
      ]
    },
    {
      path: '/richText',
      name: 'richText',
      component: layout,
      children: [
        {
          path: 'richText',
          name: 'richText',
          component: () => import('@/components/richText/richText')
        },
        {
          path: 'richUser',
          name: 'richUser',
          component: () => import('@/components/richText/richUser')
        }
      ]
    },
    {
      path: '/twoPointFive',
      name: 'twoPointFive',
      component: layout,
      children: [
        {
          path: 'wardrobeList',
          name: 'wardrobeList',
          component: () => import('@/components/twoPointFive/wardrobeList')
        },
        {
          path: 'grassList',
          name: 'grassList',
          component: () => import('@/components/twoPointFive/grassList')
        }
      ]
    },
    {
      path: '*',
      redirect: '/404'
    }
  ]
})
